1. Field of the Invention
The present invention relates to a packet dispatching method and, more particularly, to a method for rapidly dispatching H.323 packets.
2. Description of Related Art
Currently, a hardware chip or a system on chip (SoC) generally has a plurality of chips, functional blocks, or models, each having a specific function, so as to gain pipeline or parallel processing effect.
FIG. 1 shows a schematic diagram of the essentially functional blocks of a Network Address & Port Translation system on chip (NAPT SoC). In FIG. 1, the NAPT SoC consists of a dispatcher 11, a basic NAPT module 12, at least one NAPT Application Layer Gateway module (ALG module) 13 and a forwarding module 14, etc.
The dispatcher 11 receives a packet and determines what kind of the packet is. Accordingly, the packet is dispatched to the basic unit 12 or the ALG unit 13 for further processing. The basic NAPT module 12 is a general NAPT module which translates network address or port number. The ALG module 13 processes the content of specific application data in the Application Layer, such as H.323, File Transfer protocol (FTP), Session Initial Protocol (SIP), and so on. Therefore, there are plural ALG units 13 in general. The forwarding module 14 forwards packets after processed by the basic unit 12 or the ALG unit 13.
FIG. 2 shows a schematic diagram of packet dispatch from the dispatcher 11. As show in FIG. 2, the dispatcher 11 has a look up table 111 with a protocol field 1111, a port number field 1112 and a corresponding process field 1113 for the dispatcher 11 to complete packet dispatching in accordance with the look up table 111. For example, when the dispatcher 11 receives a packet with TCP protocol and port number 1720, the packet is known as an H.323 control message packet in accordance with the look up table 111, and thus the dispatcher 11 sends the packet to an H.323 ALG module 131 to process. Alternately, when the packet applies TCP protocol and has port number 21, the packet is known as an FTP control message packet in accordance with the look up table 111, and thus the dispatcher 11 sends the packet to the FTP ALG module 132 to process. Alternately, when the packet applies TCP or UDP protocol and has port number 5060, the packet is known as an SIP control message packet in accordance with the look up table 111, and thus the dispatcher 11 sends the packet to the SIP ALG module 133 to process.
However, H.323 has many sub-protocols such as Q.931/call signaling (H.225) and control signaling (H.245). Therefore, the dispatcher at front end requires dynamic add and delete functions for associated H.323 information. Namely, the look up table 111 initially established in the dispatcher records only a port number 1720 used by H.225. However, a caller or a callee in H.245 provides dynamic port number (not fixed). For example, an H.245 connection port number provided by the callee can be 1092, whereas the caller may provide port numbers 2002, 2003 to proceed multimedia data transmission for Real-Time Protocol (RTP)/Real-Time Control Protocol (RTCP) after H.245 connection is complete and the callee may provide port numbers 1092, 1093 to proceed RTP/RTCP multimedia data transmission. However, the cited port numbers 2002, 2003, 1092, 1093 are not recorded in the table 111 initially established. Accordingly, the dispatcher 11 requires dynamic add and delete functions for real-time recording new port number(s) used in H.323, so as to determine a packet type currently received according to the new port number(s). An example of using the NAPT to establish an H.323 connection is described as follows.
FIG. 3 shows a chart of message flows between end users E1 and E2 through the NAPT N1 under H.323 protocol. As shown in FIG. 3, the end user E1 applies a virtual network address A1 and a port number P0 in order to establish an H.225 connection to a port number 1720 of the end user E2. The translator N1 changes the virtual network address A1 into a public network address A0 belong to the translator N1 and the port number P0 into a port number P10 selected by the translator N1. The cited data changed is stored in a look up table 31 and subsequently a connection message is sent to the end user E2.
The end user E2 applies a virtual network address A2 and the port number 1720 to respond the connection message to the port number P10 belong to the translator N1. After the translator N1 receives a packet with the port number 1720, the packet is sent to the H.323 ALG module to process due to the port number 1720. The packet after being processed is sent to the end user E1 with the address A1 and port number P0, thereby completing the H.225 connection. Next, the end user E2 separately issues ‘Alerting’ and ‘Connect’ control message packets to the end user E1. The ‘Connect’ control message packet dynamically provides data including its address A2 and port number P100, to inform the end user E1 of H.245 connection data to be proceeded later. Packets to be delivered by the end user E2 are forwarded to the end user E1 through the translator N1. Next, the end user E1 provides the port number P1 to proceed H.245 connection to the port number P100 of the end user E2. The translator N1 determines the internal basic NAPT module or H.323 ALG module (not shown) to process a received packet sent from the end user E1, in accordance with the packet's destination port number. However, the packet's port number P100 (e.g., 1920) is not recorded in the look up table, so that the translator N1 first needs time to dynamically add or delete the port number P100, then translates the packet's address and port into its network address A0 and a selected port number P11, and finally sends the packet translated to the end user E2. Subsequently, H.245 control messages are exchanged between the end users E1 and E2 through the translator N1, thereby establishing a connection for delivering multimedia data such as RTP/RTCP and the like.
As cited, when H.225 and H.245 connections are establishing, the dispatcher 11 of the translator N1 dispatches packets to other functional block(s) for further processing in accordance with its built-in look up table. At this point, however, only port number 1720 for establishing an H.225 connection is recorded in the look up table while port number for establishing an H.245 connection is not pre-recorded in the look up table. Furthermore, the translator N1 determines required connection port number when a substantial outward connection occurs (at H.245 connection setup or a physical connection for delivering multimedia data such as RTP/RTCP and the like). Thus, the dispatcher of the translator N1 wastes much time on packet dispatching when processing H.323 packets.
A typical dispatcher mostly uses a linear-based or hash-based table to determine if a packet to be processed belongs to the H.323 ALG module. If a linear way is applied for the search, it consumes a lot of time and requires maintaining blank fields of the table for add or delete data anytime. If a hash way is applied for the search, it requires a lot of memory space to store a hash table, which may not be available for an environment with limited hardware or SoC. In addition, a content addressable memory (CAM) can be used to speed up required searching, whereas this costs much and is not practical.
Therefore, it is desirable to provide an improved method for the cited front-end dispatcher to mitigate and/or obviate the aforementioned problems, thereby avoiding slow determination caused by supporting H.323 processes and further slowing down entire performance.